<!--
* @description 点位类别详情
* @author zywu
* @date 2021/03/18 10:27:13
!-->
<template>
  <div class="point-type-detail">
    <el-card v-for="(item,i) in dataList" :key="i">
      <div slot="header" class="d-flex ai-center">
        <span class="order d-flex ai-center jc-center">{{i+1}}</span>
        <span class="item-type">{{checkTypes[item.checkType]}}</span>
        <span class="item-name">{{item.name}}</span>
      </div>
      <div v-if="item.checkType==1">
        <p v-for="(option,j) in item.options" :key="j">{{labels.substr(j,1)}}：{{option.isOk==1?'合格':'不合格'}}</p>
      </div>
      <div v-else-if="item.checkType==2">
        <p v-for="(option,j) in item.options" :key="j">
          {{labels.substr(j,1)}}：{{option.option}}
          <span
            style="margin-left:10px;color:#999;"
          >{{option.isOk==1?'合格选项':'不合格选项'}}</span>
        </p>
      </div>
      <div v-else-if="item.checkType==3">
        <p>{{item.options[0].option}}~{{item.options[1].option}}{{item.options[2].option}}</p>
      </div>
      <div v-else-if="item.checkType==4">
        <p>需至少拍{{item.options[0].option}}张照片</p>
      </div>
    </el-card>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import { getPointTypeInfo } from '@/api/inspectx'
export default {
  props: {
    dataInfo: {
      type: Object,
      required: false,
    },
  },
  computed: {},
  data() {
    return {
      labels: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
      checkTypes: ['', '合格不合格类', '单选类', '填值类', '拍照类'],
      dataList: [],
    }
  },

  components: {},

  created() {
    getPointTypeInfo({
      pointTypeId: this.dataInfo.id,
    }).then((res) => {
      this.dataList = res.data.contents
    })
  },

  mounted() {},

  methods: {},
}
</script>
<style lang='scss'>
.point-type-detail {
  .el-card {
    margin-bottom: 20px;
  }
  .el-card__header {
    padding: 12px 20px;
  }
  .el-card__body {
    padding: 10px 20px;
    p {
      margin: 5px 0;
      line-height: 20px;
    }
  }
  .order {
    margin-right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 15px;
    color: #fff;
    background: #409eff;
  }
  .item-type {
    margin-right: 10px;
    line-height: 20px;
    color: #999;
  }
  .item-name {
    flex: 1;
    line-height: 20px;
  }
}
</style>